package com.xxx.fallback;

import com.xxx.doc.CourseDoc;
import com.xxx.feignclients.CourseDocFeignClient;
import com.xxx.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CourseDocFeignClientFallback implements FallbackFactory<CourseDocFeignClient> {
    @Override
    public CourseDocFeignClient create(Throwable throwable) {
        throwable.printStackTrace();
        return new CourseDocFeignClient() {
            @Override
            public JSONResult save(CourseDoc courseDoc) {
                return JSONResult.error("调用es服务的CourseDocController#save降级了!");
            }
        };
    }
}
